package report.filter;

/**
 *
 * @author Oleh
 */
public class CreationDateFilter implements ReportFilter {
    private String from;
    private String to;
    
    public CreationDateFilter(String from, String to) {
        this.from = from;
        this.to = to;
    }

    public String getPartSqlStatement() {
        String query = null;
        if (from != null && !from.equals("")) {
            query = "creation_date >= TO_DATE('" + from + "', 'MM/DD/YYYY')";
        }
        if (to != null && !to.equals("")) {
            String queryTo = "creation_date <= TO_DATE('" + to + "', 'MM/DD/YYYY')";
            if (query != null) query += " AND " + queryTo;
            else query = queryTo;
        }
        return query;
    }
}
